import {createApp} from 'vue'
import App from './App.vue'
import 'element-plus/es/components/image/style/css'
import 'element-plus/es/components/steps/style/css'
import 'element-plus/es/components/step/style/css'
import 'element-plus/es/components/message/style/css'
import 'element-plus/es/components/alert/style/css'
import {ElImage, ElSteps, ElMessage, ElAlert, ElStep} from 'element-plus'
import 'element-plus/theme-chalk/el-image.css'
import router from './router/index.js'

async function initApp() {
    const app = createApp(App);
    app.use(ElImage)
    app.use(ElSteps)
    app.use(ElMessage)
    app.use(ElAlert)
    app.use(ElStep)
    app.use(router);
    app.mount('#app');
}

initApp()
    .then(() => {
        router.beforeEach((to, from, next) => {
            if (to.path !== '/rec') {
                next({
                    path: '/rec',
                    query: {path: to.path},
                });
            } else {
                next()
            }
        });
    });
